package com.ls.pattern.behavior.memento;

//原始对象
public class Originator {
    private String state;//状态信息

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }

    //编写一个方法,可以保存一个状态对象Memento
    public Memento saveStateMemento() {
        return new Memento(state);
    }


    //恢复状态
    public void getStateFromMemento(Memento memento) {
        state = memento.getState();
    }


}
